
#include "ipfe_for_HiBoost.h"

//// [*] CFeatureFactory_HiBoost
//
//CFeatureFactory_HiBoost::CParameters CFeatureFactory_HiBoost::Parameters;
//
//CImageFilterBank* CFeatureFactory_HiBoost::GenerateFilterBank()
//{
//	int i;
//
//	CImageFilterBank* ret = new CImageFilterBank();
//	ret->myInit();
//
//	CImageFilter_RGB* pFilter_RGB = ret->pBasicFilter_RGB;
//
//	CImageFilter_Gray* pFilter_Gray = new CImageFilter_Gray();
//	pFilter_Gray->PushBackInputResponse(pFilter_RGB, 0);
//	pFilter_Gray->PushBackInputResponse(pFilter_RGB, 1);
//	pFilter_Gray->PushBackInputResponse(pFilter_RGB, 2);
//	ret->PushBackFilter(pFilter_Gray);
//
//	CImageFilter_Lab* pFilter_Lab = new CImageFilter_Lab();
//	pFilter_Lab->PushBackInputResponse(pFilter_RGB, 0);
//	pFilter_Lab->PushBackInputResponse(pFilter_RGB, 1);
//	pFilter_Lab->PushBackInputResponse(pFilter_RGB, 2);
//	ret->PushBackFilter(pFilter_Lab);
//
//	CImageFilter_Gaussian* pFilter_Gaussian = new CImageFilter_Gaussian(Parameters.TextonSigma * 1.0);
//	pFilter_Gaussian->PushBackInputResponse(pFilter_RGB, 0);
//	pFilter_Gaussian->PushBackInputResponse(pFilter_RGB, 1);
//	pFilter_Gaussian->PushBackInputResponse(pFilter_RGB, 2);
//	pFilter_Gaussian->PushBackInputResponse(pFilter_Gray, 0);
//	pFilter_Gaussian->PushBackInputResponse(pFilter_Lab, 0);
//	pFilter_Gaussian->PushBackInputResponse(pFilter_Lab, 1);
//	pFilter_Gaussian->PushBackInputResponse(pFilter_Lab, 2);
//	ret->PushBackFilter(pFilter_Gaussian);
//
//	CImageFilter_LoG* pFilter_LoG = new CImageFilter_LoG(Parameters.TextonSigma * 1.0);
//	pFilter_LoG->PushBackInputResponse(pFilter_Lab, 0);
//	ret->PushBackFilter(pFilter_LoG);
//
//	CImageFilter_1DoG* pFilter_1DoG_X = new CImageFilter_1DoG(true, Parameters.TextonSigma * 2.0);
//	pFilter_1DoG_X->PushBackInputResponse(pFilter_Lab, 0);
//	ret->PushBackFilter(pFilter_1DoG_X);
//
//	CImageFilter_1DoG* pFilter_1DoG_Y = new CImageFilter_1DoG(false, Parameters.TextonSigma * 2.0);
//	pFilter_1DoG_Y->PushBackInputResponse(pFilter_Lab, 0);
//	ret->PushBackFilter(pFilter_1DoG_Y);
//
//	CImageFilter_DooG* pFilter_DooG[6];
//	for ( i = 0; i < 6; ++i )
//	{
//		pFilter_DooG[i] = new CImageFilter_DooG(1.0, i*PI/6, 3.0);
//		pFilter_DooG[i]->PushBackInputResponse(pFilter_Lab, 0);
//		ret->PushBackFilter(pFilter_DooG[i]);
//	}
//
//	CImageFilter_DoG* pFilter_DoG = new CImageFilter_DoG(1.0);
//	pFilter_DoG->PushBackInputResponse(pFilter_Lab, 0);
//	ret->PushBackFilter(pFilter_DoG);
//
//	// Setting Response Output
//
//	pFilter_Gaussian->PushBackOutput(0);	// Gaussian(R)
//	pFilter_Gaussian->PushBackOutput(1);	// Gaussian(G)
//	pFilter_Gaussian->PushBackOutput(2);	// Gaussian(B)
//	pFilter_Gaussian->PushBackOutput(3);	// Gaussian(Gray)
//	pFilter_Gaussian->PushBackOutput(4);	// Gaussian(L)
//	pFilter_Gaussian->PushBackOutput(5);	// Gaussian(a)
//	pFilter_Gaussian->PushBackOutput(6);	// Gaussian(b)
//	pFilter_LoG->PushBackOutput(0);			// LoG(L)
//	pFilter_1DoG_X->PushBackOutput(0);		// 1DoG_X(L)
//	pFilter_1DoG_Y->PushBackOutput(0);		// 1DoG_Y(L)
//	for ( i = 0; i < 6; ++i )
//		pFilter_DooG[i]->PushBackOutput(0);	// DooG(L, i*PI/6)
//	pFilter_DoG->PushBackOutput(0);		// DoG(L)
//
//	// Finish Filter Bank Initialization
//
//	ret->GetOutputDimension(true);
//
//	ret->SetCachePath(Parameters.strPN_IFB_Cache);
//
//	int AreaThreshold = (400+32) * (300+32);
//
//	pFilter_DooG[0]->AreaThresholdForResponseCacheUsage = AreaThreshold;
//	pFilter_DooG[1]->AreaThresholdForResponseCacheUsage = AreaThreshold;
//	pFilter_DooG[2]->AreaThresholdForResponseCacheUsage = AreaThreshold;
//	pFilter_DooG[3]->AreaThresholdForResponseCacheUsage = AreaThreshold;
//	pFilter_DooG[4]->AreaThresholdForResponseCacheUsage = AreaThreshold;
//	pFilter_DooG[5]->AreaThresholdForResponseCacheUsage = AreaThreshold;
//	pFilter_DoG->AreaThresholdForResponseCacheUsage = AreaThreshold;
//
//	//ret->EnableOutputCache(AreaThreshold, 10);
//	//ret->EnableOutputCache(AreaThreshold, 11);
//	//ret->EnableOutputCache(AreaThreshold, 12);
//	//ret->EnableOutputCache(AreaThreshold, 13);
//	//ret->EnableOutputCache(AreaThreshold, 14);
//	//ret->EnableOutputCache(AreaThreshold, 15);
//	//ret->EnableOutputCache(AreaThreshold, 16);
//
//	return ret;
//}
//
//CImagePositionFeatureExtractor* CFeatureFactory_HiBoost::GenerateIPFE(CImageFilterBank* pFixedImageFilterBank, int ShapePatternListIndex)
//{
//	ShapePatternListIndex = (ShapePatternListIndex<0 ? 0 : 
//		(ShapePatternListIndex>=(int)Parameters.ShapePatternListSet.Size ? (int)Parameters.ShapePatternListSet.Size-1 : ShapePatternListIndex));
//
//#if 1
//	int i;
//	C_IPFC_ImageFilterBankOwner* pIFBO = new C_IPFC_ImageFilterBankOwner(pFixedImageFilterBank->myClone(), Parameters.ImageExtent, false);
//	for ( i = 0; i < pFixedImageFilterBank->GetOutputDimension(); ++i )
//		pIFBO->PushBackResponseUser(new C_IPFC_ResponseUser_MeanAndVairance(Parameters.ShapePatternListSet.pElement + ShapePatternListIndex), &i);
//
//	CCompositeIPFC* pCompositeIPFC = new CCompositeIPFC();
//	pCompositeIPFC->PushBack(pIFBO);
//#else
//	int i, ii;
//	CSimpleTypeArray<int> InputResponseList;
//	InputResponseList.Clear();
//	ii = pFixedImageFilterBank->GetOutputDimension();
//	for ( i = 0; i < ii; ++i )
//		InputResponseList.PushBack(i);
//
//	CCompositeIPFC* pCompositeIPFC = new CCompositeIPFC();
//
//	pCompositeIPFC->PushBack(
//		new CResponseMeanAndVarianceIPFC(
//			pFixedImageFilterBank, Parameters.ImageExtent, InputResponseList, &Parameters.ShapePatternListSet.pElement[ShapePatternListIndex]
//			)
//		);
//#endif
//
//	CImagePositionFeatureExtractor* ret = new CBasicIPFE(pCompositeIPFC);
//
//	//cout<<ret->GetFeatureDimension()<<endl;
//	//Parameters.ShapePatternListSet.pElement[ShapePatternListIndex] = Parameters.ShapePatternListSet.pElement[0];
//	//int dd = ret->RecomputeFeatureDimension();
//	//cout<<dd<<endl;
//
//	return ret;
//}
//
//CImagePyramidPositionFeatureExtractor* CFeatureFactory_HiBoost::GenerateIPPFE(CImageFilterBank* pFixedImageFilterBank, int ShapePatternListIndex, int CacheSize)
//{
//	CImagePositionFeatureExtractor* pt = GenerateIPFE(pFixedImageFilterBank, ShapePatternListIndex);
//	CImagePyramidPositionFeatureExtractor* ret = new CImagePyramidPositionFeatureExtractor(pt, CacheSize);
//	return ret;
//}

